﻿using Bussiness.Interface;
using Bussiness.Service;
using Common.Model;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
    public List<Books> books = new List<Books>();
    public List<Books> seachbooks = new List<Books>();//根据条件查询的表
    public IBaseService baseService = new BaseService();
    protected void Page_Load(object sender, EventArgs e)
    {
        
        if (Request.QueryString["seachvalue"] != "")
        {
            string seachbook = Request.QueryString["seachvalue"];
            Result<List<Books>> seachlist = new Result<List<Books>>();
            seachlist = baseService.Select<Books>(p=>p.BookName== seachbook);
            if (seachlist.Data != null)
            {
                try
                {
                    seachbooks = seachlist.Data;
                }
                catch
                {
                    seachbooks = null;
                }
            }
        }
        if (!IsPostBack)
        {
            Result<List<Books>> list = new Result<List<Books>>();
            list = baseService.Select<Books>();
            if (list.Data != null)
            {
                try
                {
                    books = list.Data.ToList();
                  
                }
                catch (Exception ex)
                {
                    books = null;
                }
            }
        }
    }
}